
AC_PREREQ([2.69])
AC_INIT([BGSIP], [1.0.0], [gasmibal@gmail.com])
AM_INIT_AUTOMAKE([1.12.5])
AM_SILENT_RULES([yes])

AC_COPYRIGHT([Baligh GUESMI])
AC_REVISION([$Revision: 12 $])

AC_CONFIG_HEADERS([config/config.h])

AC_INCLUDES_DEFAULT 

# Define Macro used in program/lib
AC_DEFINE_UNQUOTED([BGBINDIR],        ["$bindir"],          ["The directory for installing executables that users run."])
AC_DEFINE_UNQUOTED([BGDATADIR],       ["$datadir"],         ["The directory for installing idiosyncratic read-only architecture-independent data."])
AC_DEFINE_UNQUOTED([BGDATAROOTDIR],   ["$datarootdir"],     ["The root of the directory tree for read-only architecture-independent data files."])
AC_DEFINE_UNQUOTED([BGDOCDIR],        ["$docdir"],          ["The directory for installing documentation files (other than Info and man)."])
AC_DEFINE_UNQUOTED([BGDVIDIR],        ["$dvidir"],          ["The directory for installing documentation files in DVI format."])
AC_DEFINE_UNQUOTED([BGEXECPREFIX],    ["$exec_prefix"],     ["The installation prefix for architecture-dependent files. By default it's the same as prefix. You should avoid installing anything directly to exec_prefix. However, the default value for directories containing architecture-dependent files should be relative to exec_prefix."])
AC_DEFINE_UNQUOTED([BGHTMLDIR],       ["$htmldir"],         ["The directory for installing HTML documentation."])
AC_DEFINE_UNQUOTED([BGINCLUDEDIR],    ["$includedir"],      ["The directory for installing C header files."])
AC_DEFINE_UNQUOTED([BGINFODIR],       ["$infodir"],         ["The directory for installing documentation in Info format."])
AC_DEFINE_UNQUOTED([BGLIBDIR],        ["$libdir"],          ["The directory for installing object code libraries."])
AC_DEFINE_UNQUOTED([BGLIBEXECDIR],    ["$libexecdir"],      ["The directory for installing executables that other programs run."])
AC_DEFINE_UNQUOTED([BGLOCALDIR],      ["$localdir"],        ["The directory for installing locale-dependent but architecture-independent data, such as message catalogs. This directory usually has a subdirectory per locale."])
AC_DEFINE_UNQUOTED([BGLOCALSTATEDIR], ["$localstatedir"],   ["The directory for installing modifiable single-machine data."])
AC_DEFINE_UNQUOTED([BGMANDIR],			  ["$mandir"],          ["The top-level directory for installing documentation in man format."])
AC_DEFINE_UNQUOTED([BGOLDINCLUDEDIR], ["$oldincludedir"],   ["The directory for installing C header files for non-GCC compilers."])
AC_DEFINE_UNQUOTED([BGPDFDIR],        ["$pdfdir"],          ["The directory for installing PDF documentation."])
AC_DEFINE_UNQUOTED([BGPREFIXDIR],     ["$prefix"],          ["The common installation prefix for all files. If exec_prefix is defined to a different value, prefix is used only for architecture-independent files."])
AC_DEFINE_UNQUOTED([BGPSDIR],         ["$psdir"],           ["The directory for installing PostScript documentation."])
AC_DEFINE_UNQUOTED([BGSBINDIR],       ["$sbindir"],         ["The directory for installing executables that system administrators run."])
AC_DEFINE_UNQUOTED([BGSHAREDSTATEDIR],["$sharedstatedir"],	["The directory for installing modifiable architecture-independent data."])
AC_DEFINE_UNQUOTED([BGSYSCONFDIR],    ["$sysconfdir"],      ["The directory for installing read-only single-machine data."])
#AC_DEFINE         ([BGSYSNAME],       ["$host"],            ["The Host name according to config.guess and config.sub"]

# Custum Arguments

# Checks for programs.
AC_PROG_CC
PKG_PROG_PKG_CONFIG
AC_PROG_INSTALL
#AC_PROG_LN_S
#AC_PROG_MAKE_SET
AC_PROG_RANLIB
AM_PROG_CC_C_O

# Checks for libraries.
AC_CHECK_LIB(pthread, pthread_create)
AC_CHECK_LIB([m],[cos])

# Checks for header files.
AC_HEADER_STDC
#AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h locale.h stddef.h stdint.h strings.h \
#                  sys/param.h sys/time.h sys/resource.h sys/param.h dirent.h regex.h glob.h sched.h \
#                  unistd.h zlib.h bzlib.h errno.h math.h stdarg.h setjmp.h])
AC_HEADER_ASSERT
AC_HEADER_DIRENT
AC_HEADER_MAJOR
AC_HEADER_RESOLV
AC_HEADER_STAT
AC_HEADER_STDBOOL
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
AC_HEADER_TIOCGWINSZ
AC_CHECK_HEADERS([zlib.h bzlib.h lzmalib.h lzo/lzo1x.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_INT8_T
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
#AC_CHECK_MEMBERS([struct stat.st_blksize])
AC_STRUCT_ST_BLKSIZE
AC_STRUCT_ST_BLOCKS
AC_STRUCT_ST_RDEV
AC_STRUCT_TM
AC_TYPE_SIGNAL
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
#AC_CHECK_TYPES([ptrdiff_t])

# Checks for system services
#AC_CANONICAL_SYSTEM
#AC_PATH_X
#AC_PATH_XTRA
AC_SYS_INTERPRETER
AC_SYS_LARGEFILE
AC_SYS_LONG_FILE_NAMES

# Checks for Posix Variants
# AC_USE_SYSTEM_EXTENSIONS

# Checks for Generic Compiler Characteristics
AC_LANG_WERROR

# Checks for C Compiler Characteristics
#AC_PROG_CC_STDC
#AC_PROG_CC_C89
AC_PROG_CC_C99
AC_C_BACKSLASH_A
AC_C_BIGENDIAN
AC_C_CONST
AC_C_RESTRICT
AC_C_VOLATILE
AC_C_INLINE
AC_C_CHAR_UNSIGNED
AC_C_STRINGIZE
AC_C_FLEXIBLE_ARRAY_MEMBER
AC_C_VARARRAYS
AC_C_TYPEOF
AC_C_PROTOTYPES
AC_PROG_GCC_TRADITIONAL


# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
AC_FUNC_MKTIME
AC_FUNC_MMAP
AC_FUNC_STRFTIME
AC_FUNC_MEMCMP
AC_FUNC_VPRINTF


AM_WITH_DMALLOC
#AC_CHECK_FUNCS([atexit ftruncate gettimeofday localtime_r mkdir modf munmap pow realpath regcomp rmdir tzset])

AC_CONFIG_FILES([Makefile src/Makefile])
AC_OUTPUT
